package com.aspirecn.core.object;

import org.apache.commons.lang3.builder.ReflectionToStringBuilder;

/**
 * IP段
 * 
 * @author wangxinning
 * 
 */
public class IPRange implements Comparable<IPRange>{

	private Long startIpNum;

	public Long getStartIpNum() {
		return startIpNum;
	}

	public void setStartIpNum(Long startIpNum) {
		this.startIpNum = startIpNum;
	}

	public Long getEndIpNum() {
		return endIpNum;
	}

	public void setEndIpNum(Long endIpNum) {
		this.endIpNum = endIpNum;
	}

	public int getGateway() {
		return gateway;
	}

	public void setGateway(int gateway) {
		this.gateway = gateway;
	}

	private Long endIpNum;

	// 网关，针对cmwap,cmnet和其他
	private int gateway = IP.WIFI_GATEWAY;

	public City getCity() {
		return city;
	}

	public void setCity(City city) {
		this.city = city;
	}

	public Province getProvince() {
		return province;
	}

	public void setProvince(Province province) {
		this.province = province;
	}

	// 所属城市
	private City city;

	// 所属省份
	private Province province;
	
	public String toString() {
		return ReflectionToStringBuilder.toString(this);
	}

	public int compareTo(IPRange arg0) {
		// TODO Auto-generated method stub
		IPRange tempIPRange = arg0;
		
		if( tempIPRange.getStartIpNum() > this.getStartIpNum() )
		{
			return -1;
		}
		else
		{
			return 1;
		}
	}
}